.\" t
.\" @(#)@PACKAGE@-@VERSION@ @RELDATELONG@
.TH FvwmEvent 1 "@RELDATELONG@ (@VERSION@)" Fvwm "Fvwm Modules"
.UC
.SH NAME
\fIFvwmEvent\fP \- the fvwm event module
.SH SYNOPSIS
\fIFvwmEvent\fP is a more versatile replacement for \fIFvwmAudio\fP.
It can in general be used to hook any \fIfvwm\fP function or program to any
window manager event. E.g: Delete unwanted Netscape Pop ups or
application error pop ups as they appear, play sounds, log events to a
file and the like. Be creative, you'll find a use for it.

\fIFvwmEvent\fP is spawned by \fIfvwm\fP, so no command line invocation will
work.  From within the \fI.fvwm2rc\fP file, \fIFvwmEvent\fP is spawned as
follows:
.nf
.sp
Module FvwmEvent
.sp
.fi
or from within an \fIfvwm\fP pop-up menu:
.nf
.sp
DestroyMenu Module-Popup
AddToMenu Module-Popup "Modules" Title
+ "Event"        Module FvwmEvent
+ "Auto"         Module FvwmAuto 200
+ "Buttons"      Module FvwmButtons
+ "Console"      Module FvwmConsole
+ "Ident"        Module FvwmIdent
+ "Banner"       Module FvwmBanner
+ "Pager"        Module FvwmPager 0 3
.sp
.fi
.SH DESCRIPTION
The \fIFvwmEvent\fP module communicates with the \fIfvwm\fP window manager
to bind \fIactions\fP to window manager \fIevents\fP.  Different actions
may be assigned to distinct window manager events.

\fIFvwmEvent\fP can be used to bind sound files to events like
\fIFvwmAudio\fP (RiP) did. It can be used for logging event traces to
a log file, while debugging \fIfvwm\fP.

\fIFvwmEvent\fP can also have builtin support for the rplay library.
(heritage of FvwmAudio)

.SH INVOCATION
The invocation method was shown in the synopsis section. No command
line invocation is possible. \fIFvwmEvent\fP must be invoked by the
\fIfvwm\fP window manager. \fIFvwmEvent\fP accepts a single
argument:

.IP \-audio
Enables FvwmAudio compatibility mode.

.IP alias
Makes FvwmEvent use \fIalias\fP as its name. This affects which lines
from the user's configuration file are used.

Invoking FvwmEvent as \fIFvwmAudio\fP (either by using an alias or
creating a symlink) enables FvwmAudio compatibility mode.

.sp

.SH CONFIGURATION OPTIONS
\fIFvwmEvent\fP gets config info from \fBfvwm\fP's module configuration
database (see
.IR fvwm (1),
section
.BR "MODULE COMMANDS" ),
and looks for certain configuration options:

.IP "*FvwmEvent: Cmd \fIcommand\fP"
This determines the \fIfvwm\fP function that is to be called with the
event parameters. You might want to do one of the following (details below):
.nf
.sp
	# play sounds
	*FvwmEvent: Cmd \fIbuiltin-rplay\fP

	# execute distinct fvwm functions
	*FvwmEvent: Cmd

	# execute distinct external programs
	*FvwmEvent: Cmd exec
.sp
.fi
This version of \fIFvwmEvent\fP has builtin \fIrplay\fP support which does not
need to invoke an external audio player to play sounds.  The rplay
support is enabled when \fIFvwmEvent\fP is compiled with \fIHAVE_RPLAY\fP
defined and when \fIFvwmEvent: Cmd\fP is set to \fIbuiltin-rplay\fP. See
remarks below if \fIFvwmEvent\fP is invoked in FvwmAudio compatibility mode.

For example:
.nf
.sp
	*FvwmEvent: Cmd \fIbuiltin-rplay\fP
	*FvwmEvent: add_window drip.au
.sp
.fi
rplay can be obtained via anonymous ftp at
.nf
.sp
	<URL:ftp://ftp.sdsu.edu/pub/rplay> or
	<URL:ftp://ftp.x.org/contrib/Event/audio/rplay>
.sp
.fi
\fIFvwmEvent\fP also has support for any other external program.
e.g: the rsynth 'say' command:
.nf
.sp
	*FvwmEvent: Cmd "Exec /rsynth/say"
	*FvwmEvent: destroy_window "window closed"
.sp
.fi
You can also use \fIfvwm\fP's builtin \fIEcho\fP command as
\fIFvwmEvent: Cmd\fP to obtain debug output for \fIfvwm\fP events quietly.
I used this setup to debug FvwmAuto:
.nf
.sp
	*FvwmEvent: Cmd \fIEcho\fP
	*FvwmEvent: focus_change "focus change"
	*FvwmEvent: raise_window "raise window"
.sp
.fi
You can even call different shell commands for each event just by setting
.nf
.sp
	*FvwmEvent: Cmd exec
	*FvwmEvent: add_window 'killname "APPL ERROR"'
.sp
.fi
.IP "*FvwmEvent: PassId"
Specifies that the event action will have an ID parameter added to the end
of the command line. Most events will have the windowID of the window that the
event refers to, new_desk will have the new desk number. The windowID is a
hexadecimal string preceded by 0x, desk numbers are decimal.

.IP "*FvwmEvent: \fIwindow-manager-event action-or-filename\fP"
Binds particular actions to window manager events.

e.g. for audio-events:
.nf
.sp
	*FvwmEvent: startup TaDa.au
	*FvwmEvent: shutdown Elvis_Left.au
	*FvwmEvent: unknown doh.au

	*FvwmEvent: new_page beam_trek.au
	*FvwmEvent: new_desk beam_trek.au
	*FvwmEvent: old_add_window drip.au
	*FvwmEvent: raise_window swoosh.au
	*FvwmEvent: lower_window swoosh.au
	*FvwmEvent: old_configure_window hammer.au
	*FvwmEvent: focus_change boing.au
	*FvwmEvent: enter_window boing.au
	*FvwmEvent: leave_window boing.au
	*FvwmEvent: destroy_window explosion.au
	*FvwmEvent: iconify ploop.au
	*FvwmEvent: deiconify ploop.au
	*FvwmEvent: window_name huh.au
	*FvwmEvent: icon_name beep.au
	*FvwmEvent: visible_icon_name beep.au
	*FvwmEvent: res_class beep.au
	*FvwmEvent: res_name beep.au
	*FvwmEvent: end_windowlist twang.au

	*FvwmEvent: icon_location beep.au
	*FvwmEvent: map beep.au
	*FvwmEvent: error beep.au
	*FvwmEvent: config_info beep.au
	*FvwmEvent: end_config_info beep.au
	*FvwmEvent: icon_file beep.au
	*FvwmEvent: default_icon beep.au
	*FvwmEvent: string plapper.au
	*FvwmEvent: mini_icon beep.au
	*FvwmEvent: windowshade beep.au
	*FvwmEvent: dewindowshade beep.au

	*FvwmEvent: visible_name beep.au
	*FvwmEvent: sendconfig beep.au
	*FvwmEvent: restack beep.au
	*FvwmEvent: add_window beep.au
	*FvwmEvent: configure_window beep.au

	*FvwmEvent: visible_icon_name beep.au
	*FvwmEvent: enter_window beep.au
	*FvwmEvent: leave_window beep.au
	*FvwmEvent: property_change beep.au
.sp
.fi
The window related event handlers are executed within a window
context.  Previously PassId was used for this purpose, but now using
PassId is not needed.

Note: The enter_window event is generated when the pointer enters
a window.  With the -passid option, that window's id is passed to
fvwm.  An enter_window event is generated too when the pointer
leaves a window and moves into the root window.  In this case, the
id passed is 0.

Note: When the shutdown event arrives, FvwmEvent may be killed
before it can trigger the associated action.
.sp
.fi
Provided \fIfvwm\fP supports it (not yet), there's an additional event to
replace all \fIfvwm\fP beeps with a sound:
.nf
.sp
	*FvwmEvent: beep beep.au
.sp
.fi
.IP "*FvwmEvent: Delay \fI5\fP"
Specifies that an event-action will only be executed if it occurs at
least 5 seconds after the previous event.  Events that occur during
the delay period are ignored.  This option is useful if you don't want
several sounds playing at the same time.  The default delay is 0 which
disables the Event delay.

.IP "*FvwmEvent: StartDelay \fIdelay\fP"
Specifies that an event-action will only be executed if it occurs at
least \fIdelay\fP seconds after the startup event. Events that occur during
the delay period are ignored.  This option is useful when \fIfvwm\fP
starts and restarts using an audio player.  The default delay is 0.

.SH RPLAY OPTIONS
The following options are only valid with builtin rplay support.
i.e: when \fIFvwmEvent\fP was compiled with \fIHAVE_RPLAY\fP defined.
They are used only if \fIFvwmEvent: Cmd\fP is set
to \fIbuiltin-rplay\fP.


.IP "*FvwmEvent: RplayHost \fIhostname\fP"
Specifies what host the rplay sounds will play on.  The \fIhostname\fP
can also be an environment variable such as $HOSTDISPLAY.

.IP "*FvwmEvent: RplayPriority \fI0\fP"
Specifies what priority will be assigned to the rplay sounds when they
are played.

.IP "*FvwmEvent: RplayVolume \fI127\fP"
Specifies what volume will be assigned to the sounds when they are
played.

.SH FvwmAudio Compatibility Mode

When invoked in FvwmAudio compatibility mode (see above), FvwmEvent
accepts the following options to provide backwards compatibility
for FvwmAudio:

.IP "*FvwmEvent: PlayCmd \fIcommand\fP"
This is equivalent to using *FvwmEvent: Cmd to Exec commands. This
determines the independent audio player program that will actually
play the sounds. If the play command is set to \fIbuiltin-rplay\fP
then the builtin rplay support will be used.

.IP "*FvwmAudio: Dir \fIdirectory\fP"
Specifies the directory to look for the audio files.  This option is
ignored when rplay is used.

.SH BUGS
It's REALLY noisy when \fIfvwm\fP starts and restarts using an audio player.
You can use FvwmEvent: StartDelay to fix this problem.

.SH COPYRIGHTS
This module has evolved of \fIFvwmAudio\fP, which in term is heavily based
on a similar Fvwm module called \fIFvwmSound\fP by Mark
Boyns. \fIFvwmAudio\fP simply took Mark's original program and
extended it to make it generic enough to work with any audio
player. Due to different requests to do specific things on specific events,
\fIFvwmEvent\fP took this one step further and now calls any
\fIfvwm\fP function, or builtin-rplay. If \fIfvwm\fP's Exec function
is used, any external program can be called with any parameter.

The concept for interfacing this module to the Window Manager, is
original work by Robert Nation.

Copyright 1998 Albrecht Kadlec.
Copyright 1994, Mark Boyns and Mark Scott.  No guarantees or
warranties or anything are provided or implied in any way whatsoever.
Use this program at your own risk.  Permission to use and modify this
program for any purpose is given, as long as the copyright is kept intact.


.sp
.SH AUTHORS
.nf
1994  FvwmSound  Mark Boyns       (\fIboyns@sdsu.edu\fP)
1994  FvwmAudio  Mark Scott       (\fImscott@mcd.mot.com\fP)
1996  FvwmAudio  Albrecht Kadlec
1998  FvwmEvent  Albrecht Kadlec  (\fIalbrecht@auto.tuwien.ac.at\fP)
